package com.ddtech.business.course.controller;

import com.ddtech.annotation.AnonymousAccess;
import com.ddtech.business.course.entity.CourseGrade;
import com.ddtech.business.course.query.CourseGradeQuery;
import com.ddtech.business.course.service.CourseGradeService;
import com.ddtech.framework.log.aop.log.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @version v1.0
 * @ClassName:CourseGradeController description：
 * @author:wei_zhang(xiao)
 * @date: 2023-06-02 15:05
 */
@Api(tags = "PC-课程评价")
@RestController
@RequestMapping("/course-grade")
public class CourseGradeController {

    @Autowired
    private CourseGradeService courseGradeService;

    @Log("新增课程评分")
    @ApiOperation(value = "新增课程评分")
    @PostMapping(value = "/create")
    public ResponseEntity create(@RequestBody CourseGrade courseGrade) {
        courseGradeService.create(courseGrade);
        return new ResponseEntity(true,HttpStatus.OK);
    }

    @ApiOperation(value = "查询课程评论-PC、移动端")
    @GetMapping(value = "/page-list-pc")
    @AnonymousAccess
    public ResponseEntity getPageCourseGradeListPc(CourseGradeQuery courseGradeQuery) {
        return new ResponseEntity(courseGradeService.pageCourseGradeListPc(courseGradeQuery), HttpStatus.OK);
    }
}
